/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ColorChooser.java
 *
 * Created on Aug 5, 2009, 3:56:02 PM
 */

package Falcon;

import java.awt.Color;
import javax.swing.JButton;
import org.jdesktop.application.Action;

/**
 *
 * @author jcoleman
 */
public class ColorChooser extends javax.swing.JDialog {

    private Color payloadLineColor_;
    private Color predLineColor_;
    private Color origPredLineColor_;
    private Color recoveryLineColor_;


    /** Creates new form ColorChooser */
    public ColorChooser(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();

        payloadLineColor_ = new Color(0x151B8D);
        predLineColor_ = new Color(0xFF0000);
        origPredLineColor_ = new Color(0xFFFF00);
        recoveryLineColor_ = new Color(0x008080);
        buttonGroup1.add(payloadLineRadioButton);
        buttonGroup1.add(predictionLineRadioButton);
        buttonGroup1.add(origPredLineRadioButton);
        buttonGroup1.add(recoveryLineRadioButton);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jColorChooser1 = new javax.swing.JColorChooser();
        payloadLineRadioButton = new javax.swing.JRadioButton();
        predictionLineRadioButton = new javax.swing.JRadioButton();
        origPredLineRadioButton = new javax.swing.JRadioButton();
        recoveryLineRadioButton = new javax.swing.JRadioButton();
        jLabel1 = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        jSeparator2 = new javax.swing.JSeparator();
        jButton1 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setName("Form"); // NOI18N

        jColorChooser1.setName("jColorChooser1"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(Falcon.FalconMainApp.class).getContext().getResourceMap(ColorChooser.class);
        payloadLineRadioButton.setText(resourceMap.getString("payloadLineRadioButton.text")); // NOI18N
        payloadLineRadioButton.setName("payloadLineRadioButton"); // NOI18N

        predictionLineRadioButton.setText(resourceMap.getString("predictionLineRadioButton.text")); // NOI18N
        predictionLineRadioButton.setName("predictionLineRadioButton"); // NOI18N

        origPredLineRadioButton.setText(resourceMap.getString("origPredLineRadioButton.text")); // NOI18N
        origPredLineRadioButton.setName("origPredLineRadioButton"); // NOI18N

        recoveryLineRadioButton.setText(resourceMap.getString("recoveryLineRadioButton.text")); // NOI18N
        recoveryLineRadioButton.setName("recoveryLineRadioButton"); // NOI18N

        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        jSeparator1.setName("jSeparator1"); // NOI18N

        jSeparator2.setName("jSeparator2"); // NOI18N

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(Falcon.FalconMainApp.class).getContext().getActionMap(ColorChooser.class, this);
        jButton1.setAction(actionMap.get("setColor")); // NOI18N
        jButton1.setText(resourceMap.getString("jButton1.text")); // NOI18N
        jButton1.setName("jButton1"); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jColorChooser1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jSeparator2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 152, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(predictionLineRadioButton, javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(origPredLineRadioButton, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(recoveryLineRadioButton, javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(payloadLineRadioButton, javax.swing.GroupLayout.Alignment.LEADING))
                    .addComponent(jButton1))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jColorChooser1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(19, 19, 19)
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(payloadLineRadioButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(predictionLineRadioButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(origPredLineRadioButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(recoveryLineRadioButton)
                        .addGap(18, 18, 18)
                        .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton1)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                ColorChooser dialog = new ColorChooser(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }

    @Action
    public void setColor() {
        if(buttonGroup1.isSelected(payloadLineRadioButton.getModel())){
            payloadLineColor_ = jColorChooser1.getColor();
        }else if(buttonGroup1.isSelected(predictionLineRadioButton.getModel())){
            predLineColor_ = jColorChooser1.getColor();
        }else if(buttonGroup1.isSelected(origPredLineRadioButton.getModel())){
            origPredLineColor_ = jColorChooser1.getColor();
        }else if(buttonGroup1.isSelected(recoveryLineRadioButton.getModel())){
            recoveryLineColor_ = jColorChooser1.getColor();
        }
    }

    public Color getPayloadLineColor(){
        return payloadLineColor_;
    }

    public Color getPredLineColor(){
        return predLineColor_;
    }

    public Color getOrigPredLineColor(){
        return origPredLineColor_;
    }

    public Color getRecoveryLineColor(){
        return recoveryLineColor_;
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JButton jButton1;
    private javax.swing.JColorChooser jColorChooser1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JRadioButton origPredLineRadioButton;
    private javax.swing.JRadioButton payloadLineRadioButton;
    private javax.swing.JRadioButton predictionLineRadioButton;
    private javax.swing.JRadioButton recoveryLineRadioButton;
    // End of variables declaration//GEN-END:variables

}
